<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="./src/css/layui.css">
	</head>
	<body>
		<div class="demoTable">
		  搜索商品名：
		  <div class="layui-inline">
		    <input class="layui-input" name="id" id="demoReload" autocomplete="off">
		  </div>
		  <button class="layui-btn" data-type="reload">搜索</button>
		  搜索卖家姓名：
		  <div class="layui-inline">
		    <input class="layui-input" name="id" id="demoReload" autocomplete="off">
		  </div>
		  <button class="layui-btn" data-type="reload">搜索</button>
		  <div class="layui-inline">
		                  <input type="text" id="createTimeStart" class="layui-input userName"
		                         name="createTimeStart" placeholder="操作时间(开始)" value="">
		              </div>
		              <div class="layui-inline">
		                  <input type="text" id="createTimeEnd" class="layui-input userName"
		                         name="createTimeEnd" placeholder="操作时间(结束)" value="">
		              </div>
		              <a class="layui-btn search_btn" lay-submit="" data-type="search" lay-filter="search">查询</a>
		</div>
		<table id="auction_goods" lay-filter="auction_goods"></table>
		<script type="text/html" id="barEdit">
		        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
		        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
		</script>
		<script src="./src/layui.js"></script>
		<script>
			layui.use(['table','form','jquery','layer','laypage','laytpl','laydate'],function () {
			    var table=layui.table,
			        $=layui.jquery,
			        laypage=layui.laypage,
			        layer=layui.layer,
			        laytpl=layui.laytpl,
					laydate=layui.laydate;
			    table.render({
			        id:"auction_goodsId",
			        elem:'#auction_goods',
			        cellMinWidth: 80,
			        url:'./拍卖模块数据.json',
			        page:true,
			        limit:10,
			        limits:[10,20,30],
			        //开启工具栏
			        toolbar:true,
			        cols:[
			            [
			                {type:'checkbox'},//开启复选框
			                {title:'拍卖商品序号',field:'id',sort:'true'},
							{title:'拍卖商品名',field:'id'},
							{title:'卖家昵称',field:'id'},
							// {title:'拍卖商品类型',field:'birthday'},
							{title:'拍卖描述',field:'email',sort:'true'},
							{title:'商品数量',field:'email',sort:'true'},
							{title:'起拍价格',field:'birthday'},
							{title:'加价幅度',field:'birthday'},
			                {title:'意向价格',field:'fullname',sort:'true'},
			                {title:'商品状态',field:'email',sort:'true'},
			                {title:'拍卖开始时间',field:'sex',templet:'#sexTml'},
			                {title:'拍卖结束时间',field:'address',sort:'true'},
							{title:'上传时间',field:'id',sort:'true'},
			                {title:'更新时间',field:'roleName'},
							{title:'操作',templet:'#barEdit'}
			            ]
			        ],
			        //处理从服务器端传过来的数据
			        parseData:function (result) {
			            return {
			                code: result.code == 200 ? 0 : result.code,
			                msg: result.message,
			                data: result.data.list,
			                count: result.data.total
			            }
			        }
			    });
				// 这里的auction_goods是table的lay-fileter
				table.on('tool(auction_goods)',function(row){
					var event=row.event,
					data=row.data;
					if(event==='edit'){
						layer.open({
							type:2,
							title:'商品信息编辑',
							area:['600PX','660PX'],
							content:'拍卖商品修改页面.html'
						});
					}else if(event==='del'){
						layer.confirm('确定删除吗?',function(index){
							$.ajax({
								type:'delete',
								dataType:'json',
								url:'',
								success:function(result){
									if(result.code==200){
										layer.msg('删除成功',{icon:1},function(){
											parent.location.reload();
										})
									}else{
										layer.msg(result.message,{icon:5})
									}
								}
								
								
							})
							
							
						})
					}
				})
				
				})
		</script>
	</body>
</html>
